## GUdevEnumerator GUdevEnumerator — Lookup and sort devices |

## Functions

GUdevEnumerator * | g_udev_enumerator_new ()
GUdevEnumerator * | g_udev_enumerator_add_match_subsystem ()
GUdevEnumerator * | g_udev_enumerator_add_nomatch_subsystem ()
GUdevEnumerator * | g_udev_enumerator_add_match_sysfs_attr ()
GUdevEnumerator * | g_udev_enumerator_add_nomatch_sysfs_attr ()
GUdevEnumerator * | g_udev_enumerator_add_match_property ()
GUdevEnumerator * | g_udev_enumerator_add_match_name ()
GUdevEnumerator * | g_udev_enumerator_add_match_tag ()
GUdevEnumerator * | g_udev_enumerator_add_match_is_initialized ()
GUdevEnumerator * | g_udev_enumerator_add_sysfs_path ()
GList * | g_udev_enumerator_execute ()

## Properties

GUdevClient * | client | Read / Write / Construct Only

## Types and Values

| GUdevEnumerator
struct | GUdevEnumeratorClass

## Object Hierarchy

        GObject
        ╰── GUdevEnumerator

## Description

GUdevEnumerator is used to lookup and sort devices.

## Functions

### g_udev_enumerator_new ()

    GUdevEnumerator *
    g_udev_enumerator_new (GUdevClient *client);

Constructs a GUdevEnumerator object that can be used to enumerate and sort devices. Use the add_match_*() and add_nomatch_*() methods and execute the query to get a list of devices with `g_udev_enumerator_execute()`.

#### Parameters

client | A GUdevClient to enumerate devices from. |

#### Returns

A new GUdevEnumerator object. Free with `g_object_unref()`.

Since: 165

### g_udev_enumerator_add_match_subsystem ()

    GUdevEnumerator *
    g_udev_enumerator_add_match_subsystem (GUdevEnumerator *enumerator,
                                           const gchar *subsystem);

All returned devices will match the given `subsystem` .

#### Parameters

enumerator | A GUdevEnumerator. |
subsystem | Wildcard for subsystem name e.g. 'scsi' or 'a*'. |

#### Returns

The passed in `enumerator` .

[transfer none]

Since: 165

### g_udev_enumerator_add_nomatch_subsystem ()

    GUdevEnumerator *
    g_udev_enumerator_add_nomatch_subsystem
                                   (GUdevEnumerator *enumerator,
                                    const gchar *subsystem);

All returned devices will not match the given `subsystem` .

#### Parameters

enumerator | A GUdevEnumerator. |
subsystem | Wildcard for subsystem name e.g. 'scsi' or 'a*'. |

#### Returns

The passed in `enumerator` .

[transfer none]

Since: 165

### g_udev_enumerator_add_match_sysfs_attr ()

    GUdevEnumerator *
    g_udev_enumerator_add_match_sysfs_attr
                                   (GUdevEnumerator *enumerator,
                                    const gchar *name,
                                    const gchar *value);

All returned devices will have a sysfs attribute matching the given `name` and `value` .

#### Parameters

enumerator | A GUdevEnumerator. |
name | Wildcard filter for sysfs attribute key. |
value | Wildcard filter for sysfs attribute value. |

#### Returns

The passed in `enumerator` .

[transfer none]

Since: 165

### g_udev_enumerator_add_nomatch_sysfs_attr ()

    GUdevEnumerator *
    g_udev_enumerator_add_nomatch_sysfs_attr
                                   (GUdevEnumerator *enumerator,
                                    const gchar *name,
                                    const gchar *value);

All returned devices will not have a sysfs attribute matching the given `name` and `value` .

#### Parameters

enumerator | A GUdevEnumerator. |
name | Wildcard filter for sysfs attribute key. |
value | Wildcard filter for sysfs attribute value. |

#### Returns

The passed in `enumerator` .

[transfer none]

Since: 165

### g_udev_enumerator_add_match_property ()

    GUdevEnumerator *
    g_udev_enumerator_add_match_property (GUdevEnumerator *enumerator,
                                          const gchar *name,
                                          const gchar *value);

All returned devices will have a property matching the given `name` and `value` .

#### Parameters

enumerator | A GUdevEnumerator. |
name | Wildcard filter for property name. |
value | Wildcard filter for property value. |

#### Returns

The passed in `enumerator` .

[transfer none]

Since: 165

### g_udev_enumerator_add_match_name ()

    GUdevEnumerator *
    g_udev_enumerator_add_match_name (GUdevEnumerator *enumerator,
                                      const gchar *name);

All returned devices will match the given `name` .

#### Parameters

enumerator | A GUdevEnumerator. |
name | Wildcard filter for kernel name e.g. "sda*". |

#### Returns

The passed in `enumerator` .

[transfer none]

Since: 165

### g_udev_enumerator_add_match_tag ()

    GUdevEnumerator *
    g_udev_enumerator_add_match_tag (GUdevEnumerator *enumerator,
                                     const gchar *tag);

All returned devices will match the given `tag` .

#### Parameters

enumerator | A GUdevEnumerator. |
tag | A udev tag e.g. "udev-acl". |

#### Returns

The passed in `enumerator` .

[transfer none]

Since: 165

### g_udev_enumerator_add_match_is_initialized ()

    GUdevEnumerator *
    g_udev_enumerator_add_match_is_initialized
                                   (GUdevEnumerator *enumerator);

All returned devices will be initialized.

#### Parameters

enumerator | A GUdevEnumerator. |

#### Returns

The passed in `enumerator` .

[transfer none]

Since: 165

### g_udev_enumerator_add_sysfs_path ()

    GUdevEnumerator *
    g_udev_enumerator_add_sysfs_path (GUdevEnumerator *enumerator,
                                      const gchar *sysfs_path);

Add a device to the list of devices, to retrieve it back sorted in dependency order.

#### Parameters

enumerator | A GUdevEnumerator. |
sysfs_path | A sysfs path, e.g. "/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda" |

#### Returns

The passed in `enumerator` .

[transfer none]

Since: 165

### g_udev_enumerator_execute ()

    GList *
    g_udev_enumerator_execute (GUdevEnumerator *enumerator);

Executes the query in `enumerator` .

#### Parameters

enumerator | A GUdevEnumerator. |

#### Returns

A list of GUdevDevice objects. The caller should free the result by using `g_object_unref()` on each element in the list and then `g_list_free()` on the list.

[element-type GUdevDevice][transfer full]

Since: 165

## Types and Values

### GUdevEnumerator

    typedef struct _GUdevEnumerator GUdevEnumerator;

The GUdevEnumerator struct is opaque and should not be accessed directly.

Since: 165

### struct GUdevEnumeratorClass

    struct GUdevEnumeratorClass {
      GObjectClass   parent_class;
    };

Class structure for GUdevEnumerator.

#### Members

GObjectClass `parent_class`; | Parent class. |

Since: 165

## Property Details

### The `“client”` property

      “client”                   GUdevClient *

The GUdevClient to enumerate devices from.

Flags: Read / Write / Construct Only

Since: 165